import './pagination.html';


Template.Admin_pagination.helpers({
  
	  //以下都是分页器的方法pagation methods

  isLastCan() {

  	let page = this.page;

  	if (page>1) {
  		return true;
  	}
  	return false;
  },

//前一个省略页数的计算
	pageApostropheNumberFormer(){
		let current_page = this.page-2;
		let range_page = (current_page-2)/2;
		if (range_page >= 4) {
			return Math.ceil(range_page);
		}
		return 4;
	},

	isPageApostropheNumberFormerCan(){
		let current_page = this.page;
		let range_page = (current_page-3)/2;
		if (range_page >= 2) {
			return true;
		}
		return false;
	},


  isPageNumberGreaterSeven() {
  	let page = this.page+1;
  	if (page>=7 ) {
  		return true;
  	}
  	return false;
  },
   isPageNumberRangeFourToFive() {
  	let page = this.page;
  	if (page<=4 && page>=3 ) {
  		return true;
  	}
  	return false;
  },

  isActive(pageNumber){
  	let page = this.page;
  	if (page == pageNumber) {return "active"};

  },
  pageNumber(offset=0){
  	if (this.page == NaN) {
  		return '...';
  	}
  	return this.page+parseInt(offset);
  	
  	
  }


});